import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:vc_package/common/widget/theme_text.dart';
import 'package:vc_package/widget/extension.dart';

import '../../utils/base_color_utils.dart';
import '../../widget/clickable.dart';
import '../../widget/line_view.dart';
import '../../widget/visible_view.dart';

class ThemeListItem extends StatelessWidget {
  final String? title;
  final String? value;
  final bool? showLine;
  final FontWeight? fontWeight;
  final Function()? onTap;

  const ThemeListItem({
    super.key,
    this.title,
    this.value,
    this.onTap,
    this.showLine = true,
    this.fontWeight = FontWeight.normal,
  });

  @override
  Widget build(BuildContext context) {
    var container = Container(
      color: Colors.white,
      child: Column(
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              ThemeText(
                title,
                m: EdgeInsets.only(left: 18.fit, top: 17.fit, bottom: 17.fit),
              ),
              Expanded(
                child: Row(
                  children: [
                    Expanded(
                      child: ThemeText(
                        value,
                        a: Alignment.centerRight,
                        m: EdgeInsets.only(
                            right: onTap != null ? 0 : 18.fit,
                            top: 17.fit,
                            bottom: 17.fit),
                      ),
                    ),
                    VisibleView(
                      visible: onTap != null,
                      child: Container(
                        margin: EdgeInsets.only(right: 14.fit),
                        child: Icon(
                          Icons.keyboard_arrow_right_outlined,
                          color: ColorUtils.blackNormal.withOpacity(0.2),
                        ),
                      ),
                    ),
                  ],
                ),
              ),
            ],
          ),
          VisibleView(
            visible: showLine == true,
            child: const LineView(),
          ),
        ],
      ),
    );

    return onTap == null
        ? container
        : Clickable(onTap: onTap, child: container);
  }
}
